
import java.util.ArrayList;


// to represent branches in a tree
public class Branch {

    // points to the corresponding node in this tree
    Node data;
    // the parent of this branch
    Branch parent;
    // the children of this branch
    ArrayList<Branch> children;

    // constructor
    Branch() {
        this.data = null;
        this.parent = this;
        this.children = new ArrayList<Branch>();
    }

    // constructor
    Branch(Node data) {
        this.data = data;
        this.parent = this;
        this.children = new ArrayList<Branch>();
    }

    // the tick function for when the MazeGame is operating
    // a depth search
    public Branch depthTick() {
        this.data.status = "checked";
        int index = 0;
        while (index < this.children.size()) {
            if (!this.children.get(index).data.status.equals("checked")) {
                Node n = this.children.get(index).data;
                n.status = "checking";
                return this.children.get(index);
            }
            index++;
        }
        return this.parent.depthTick();
    }


}
